/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package be.free.ts.project;

import be.free.ts.customer.Customer;
import be.free.ts.support.AbstractPersistable;
import be.free.ts.support.Interval;
import be.free.ts.support.validation.ValidInterval;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author Christophe De Blende
 * @since 08/12/12
 */
@Entity
public class Project extends AbstractPersistable {

	protected Project() {
		// use the builder
	}

	@NotNull
	@Size(min = 3, max = 80)
	private String name;

	@Lob
	@Size(min = 3)
	private String description;

	@NotNull
	@ManyToOne
	private Customer customer;

	@NotNull
	@Embedded
	@ValidInterval
	private Interval interval;

	public Interval getInterval() {
		return interval;
	}

	public String getName() {
		return name;
	}

	public String getDescription() {
		return description;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public void setInterval(Interval interval) {
		this.interval = interval;
	}

}
